﻿@using Online_Course.Web.Apps
@model Online_Course.Domain.SysUser
@{
    Layout = null;
}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>修改密码</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link href="~/css/style.css" rel="stylesheet" />
</head>
<body style="background:url(/Images/2.jpg);background-size:100% 100%;background-repeat:no-repeat;background-attachment:fixed;">

    <div class="login-container">
        <h1>修改密码</h1>

        <div class="connect">
            <p>Endless learning</p>
        </div>

        <div>
            <div>
                <input type="text"  name="username" class="username" placeholder="登录账号" autocomplete="off" />
            </div>
            <div>
                <input type="password" name="password" class="password" placeholder="密码" oncontextmenu="return false" onpaste="return false" />
            </div>
            <div>
                <input type="password" id="confirm_password" name="confirm_password" class="confirm_password" placeholder="再次输入密码" oncontextmenu="return false" onpaste="return false" />
            </div>

            <div>
                <tr>
                    <td> 验证码：</td>
                    <td><input name="txtValidate" id="txtValidate" type="text" style="width:60px; " class="loginpng" onclick="JavaScript:this.value=''" /></td>
                    <td>
                        &nbsp; <img src="../../png.aspx" id="img" onclick="f_refreshtype()" />
                    </td>
                    <td></td>
                </tr>

            </div>
            <div>
            </div>

            <button id="submit" type="submit">确 认</button>
        </div>
        <a href="../main.htm">
            <button type="button" class="register-tis">返回首页</button>
        </a>
    </div>

    <script src="/js/jquery.min.js"></script>
    <script src="/js/common.js"></script>
    <!--背景图片自动更换-->
    <script src="/js/supersized.3.2.7.min.js"></script>
    <script src="/js/supersized-init.js"></script>
    <!--表单验证-->
    <script src="/js/jquery.validate.min.js?var1.14.0"></script>
    <script language="javascript">
        $(function () {
            $("#submit").click(function () {
                var password = $("[name='password']").val();
                var username = $("[name='username']").val();
                var txtVal = $("[name='txtValidate']").val();
                var confirm_password = $("#confirm_password").val();
                if ($.trim(username).length < 3) {
                    alert("账号长度不能<3，请重新输入!");
                    $("[name='username']").focus();
                    return false;
                }
                if ($.trim(password).length < 3) {
                    alert("密码长度不能<3，请重新输入!");
                    $("[name='password']").focus();
                    return false;
                }
                data = {
                    "username":username,
                    "password": password,
                    "txtValidate": txtVal,
                    "confirm_password": confirm_password
                }
                $.ajax({
                    url: "/SysUser/Modify",
                    type: "post",
                    data: data,
                    success: function (data) {
                            if (data == "0") {
                                alert("验证码错误!");
                                $("[name='txtValidate']").focus();
                            }
                            else
                                if(data=="1")
                                {
                                    alert("密码与确认密码不一致!");
                                    $("#confirm_password").focus();
                                }
                            else {
                                alert(data);
                                $(location).attr("href", "Login");
                            }
                    }
                })
            })
        });
        function OnFailure(result) {
            alert("系统错误,无法登录，请与管理员联系!\n");
        }
        //点击切换验证码
        function f_refreshtype() {
            var Image1 = document.getElementById("img");
            if (Image1 != null) {
                Image1.src = Image1.src + "?";
            }
        }
    </script>

</body>



</html>